﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using DTO;

namespace BUS
{
    public class BUS_KhuyenMai
    {
        DAO_KhuyenMai dao_KhuyenMai;
        public BUS_KhuyenMai()
        {
            dao_KhuyenMai = new DAO_KhuyenMai();
        }
        public string GetTenKM(int maKM)
        {
            return dao_KhuyenMai.GetTenKM(maKM);
        }
        public int laySoLuongDatHang(int makm)
        {
            return dao_KhuyenMai.getSoLuongDatHang(makm);
        }
        public DTO_KhuyenMai GetTinKM(int maKM)
        {
            return dao_KhuyenMai.GetDetail(maKM);
        }
        public bool deleteTinKM(int MaKM)
        {
            return dao_KhuyenMai.deleteTinKM(MaKM);
        }
        public List<DTO_KM> GetDSTinKMTheoLoai(int LoaiKM)
        {
            return dao_KhuyenMai.GetDSTinKMTheoLoai(LoaiKM);
        }
        public List<string> getListImages(int makm)
        {
            List<string> list = new List<string>();
            List<DTO_HinhAnh> images = dao_KhuyenMai.getListImages(makm);
            for (int i = 0; i < images.Count; i++)
            {
                list.Add(images[i].HinhAnh);
            }
            return list;
        }
        public List<DTO_KM> GetDSTinKM()
        {
            return dao_KhuyenMai.GetDSTinKM();
        }
        public bool AdThemTinKM(DTO_KhuyenMai km)
        {
            return dao_KhuyenMai.AdThemTinKM(km);
            //return true;
        }
        public bool ThemTinKM(int loaiKM, string tenKM, int donGiaCu, int donGiaMoi,string bd, string kt,string moTa, int doanhNghiep, string noiBat, string dksd, string chiTiet,string hinhAnh, string video, int hinhThucGiao , int tinhTrang,int khuVuc, List<string> list_imgs )
        {
            return dao_KhuyenMai.ThemTinKM(loaiKM, tenKM, donGiaCu, donGiaMoi, bd, kt, moTa, doanhNghiep, noiBat, dksd, chiTiet, hinhAnh, video,hinhThucGiao , tinhTrang ,khuVuc,list_imgs);
            //return true;
        }

        public List<DTO_KhuyenMai> SelectAll()
        {
            return dao_KhuyenMai.SelectAll();
        }
        public List<DTO_KhuyenMai> SelectAll(int makv)
        {
            return dao_KhuyenMai.SelectAll(makv);
        }
        public List<DTO_KhuyenMai> SelectTop10(string makm)
        {
            return dao_KhuyenMai.SelectTop10(makm);
        }
        public List<DTO_KhuyenMai> GetDetails(string makm)
        {
            return dao_KhuyenMai.GetDetails(makm);
        }
        public List<DTO_KhuyenMai> SelectInType(string type)
        {
            return dao_KhuyenMai.SelectInType(type);
        }
        public List<DTO_KhuyenMai> SelectInType(string type, int khuvuc)
        {
            return dao_KhuyenMai.SelectInType(type,khuvuc);
        }
        public bool UpdateTinKM(DTO_KhuyenMai km)
        {
            return dao_KhuyenMai.UpdateTinKM(km);
        }
    }
}
